home *** CD-ROM | disk | FTP | other *** search
- 100 'Investment History ("INVHISTORY")
- 110 CLS
- 120 COLOR 0,15 : PRINT "Investment History" : COLOR 15,0
- 130 DEFDBL A-Z
- 140 DEFINT M-N, Y
- 150 'Templates for printing numbers
- 160 PCTFMT$ = "###.##_%"
- 170 MONEYFMT$ = "$$##,###,###.##"
- 180 ' Let user enter data
- 190 PRINT
- 200 PRINT "Do not enter dollar signs or commas"
- 210 PRINT
- 220 INPUT "Purchase price: ", PV
- 230 INPUT "Term (in years): ", NYEARS
- 240 INPUT "Annual income (as percent of purchase price): ", RINCOME
- 250 INPUT "Annual capital gains (in percent): ", RCGAINS
- 260 INPUT "Annual interest rate on savings (in percent): ", AR
- 270 INPUT "Number of years to start of income stream : ", NDELAY
- 280 ' Convert percent rate to decimal
- 290 RINCOME = RINCOME / 100
- 300 RCGAINS = RCGAINS / 100
- 310 AR = AR / 100
- 320 PRINT
- 330 PRINT "Press space bar to see next year's results"
- 340 PRINT
- 350 ' Initialize values
- 360 TOTALINCOME = 0
- 370 PRICE = PV
- 380 ' Calculate each year's values
- 390 FOR YEAR = 1 TO NYEARS
- 400 'Wait for user to press key
- 410 WHILE INKEY$ = "" : WEND
- 420 PRICE = PRICE * (1 + RCGAINS)
- 430 TOTALINCOME = TOTALINCOME * (1 + AR)
- 440 IF YEAR > NDELAY THEN TOTALINCOME = TOTALINCOME + PV * RINCOME
- 450 CAPITALGAINS = PRICE - PV
- 460 ANNUALYIELD = ( (PRICE + TOTALINCOME) / PV) ^ (1 / YEAR) - 1
- 470 ANNUALYIELD = 100 * ANNUALYIELD
- 480 'Print results
- 490 PRINT
- 500 PRINT "Year: "; YEAR
- 510 PRINT "Current price of investment: "; TAB(32);
- 520 PRINT USING MONEYFMT$; PRICE
- 530 PRINT "Capital gains: ";TAB(32);
- 540 PRINT USING MONEYFMT$; CAPITALGAINS
- 550 PRINT "Total income: "; TAB(32);
- 560 PRINT USING MONEYFMT$; TOTALINCOME
- 570 PRINT "Rate of return: "; TAB(41); USING PCTFMT$; ANNUALYIELD
- 580 NEXT YEAR
- 590 END